home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 1.iso / dist / fw_exmh.idb / usr / freeware / lib / exmh-2.5 / seditCompose.tcl.z / seditCompose.tcl
Text File  |  2002-07-08  |  4KB  |  134 lines

  1. # seditCompose.tcl
  2. #
  3. # This routine defines a table that maps from two-character sequences,
  4. # which are typed after the Compose key, into 8-bit input characters.
  5. #
  6. # Copyright (c) 1993 Xerox Corporation.
  7. # Use and copying of this software and preparation of derivative works based
  8. # upon this software are permitted. Any distribution of this software or
  9. # derivative works must comply with all applicable United States export
  10. # control laws. This software is made available AS IS, and Xerox Corporation
  11. # makes no warranty about the software, its performance or its conformity to
  12. # any specification.
  13.  
  14. proc SeditComposedKey { w a1 a2 } {
  15.     global composedkey sedit
  16.  
  17.     if [info exists composedkey($a1$a2)] {
  18.     SeditInsert $w "$composedkey($a1$a2)"
  19.     if {$sedit($w,quote) < 0} {
  20.         set sedit($w,quote) 1
  21.     }
  22.     } elseif [info exists composedkey($a2$a1)] {
  23.     SeditInsert $w "$composedkey($a2$a1)"
  24.     if {$sedit($w,quote) < 0} {
  25.         set sedit($w,quote) 1
  26.     }
  27.     } else {
  28.     SeditInsert $w "$a1$a2"
  29.     }
  30.     bind SeditText <Any-Key> { SeditInsert %W %A }
  31. }
  32.  
  33. proc SeditComposedKeyBindings {} {
  34.     global composedkey
  35.  
  36.     set composedkey("a) "\xE4"
  37.     set composedkey("e) "\xEB"
  38.     set composedkey("i) "\xEF"
  39.     set composedkey("u) "\xFC"
  40.     set composedkey("o) "\xF6"
  41.     set composedkey("A) "\xC4"
  42.     set composedkey("E) "\xCB"
  43.     set composedkey("I) "\xCF"
  44.     set composedkey("O) "\xD6"
  45.     set composedkey("U) "\xDC"
  46.     set composedkey(`a) "\xE0"
  47.     set composedkey(`e) "\xE8"
  48.     set composedkey(`i) "\xEC"
  49.     set composedkey(`u) "\xF9"
  50.     set composedkey(`o) "\xF2"
  51.     set composedkey(`A) "\xC0"
  52.     set composedkey(`E) "\xC8"
  53.     set composedkey(`I) "\xCC"
  54.     set composedkey(`O) "\xD2"
  55.     set composedkey(`U) "\xD9"
  56.     set composedkey(^a) "\xE2"
  57.     set composedkey(^e) "\xEA"
  58.     set composedkey(^i) "\xEE"
  59.     set composedkey(^u) "\xFB"
  60.     set composedkey(^o) "\xF4"
  61.     set composedkey(^A) "\xC2"
  62.     set composedkey(^E) "\xCA"
  63.     set composedkey(^I) "\xCE"
  64.     set composedkey(^O) "\xD4"
  65.     set composedkey(^U) "\xDB"
  66.     set composedkey('a) "\xE1"
  67.     set composedkey('e) "\xE9"
  68.     set composedkey('i) "\xED"
  69.     set composedkey('u) "\xFA"
  70.     set composedkey('o) "\xF3"
  71.     set composedkey('y) "\xFD"
  72.     set composedkey('A) "\xC1"
  73.     set composedkey('E) "\xC9"
  74.     set composedkey('I) "\xCD"
  75.     set composedkey('O) "\xD3"
  76.     set composedkey('U) "\xDA"
  77.     set composedkey('Y) "\xDD"
  78.     set composedkey(/o) "\xF8"
  79.     set composedkey(/O) "\xD8"
  80.     set composedkey(ae) "\xE6"
  81.     set composedkey(AE) "\xC6"
  82.     set composedkey(~a) "\xE3"
  83.     set composedkey(~o) "\xF5"
  84.     set composedkey(~n) "\xF1"
  85.     set composedkey(~A) "\xC3"
  86.     set composedkey(~O) "\xD5"
  87.     set composedkey(~N) "\xD1"
  88.     set composedkey(aa) "\xE5"
  89.     set composedkey(AA) "\xC5"
  90.     set composedkey(*a) "\xE5"
  91.     set composedkey(*A) "\xC5"
  92.     set composedkey(\"\") "\xA8"
  93.     set composedkey(,,) "\xB8"
  94.     set composedkey(!!) "\xA1"
  95.     set composedkey(??) "\xBF"
  96.     set composedkey(ss) "\xDF"
  97.     set composedkey(|c) "\xA2"
  98.     set composedkey(-l) "\xA3"
  99.     set composedkey(,c) "\xE7"
  100.     set composedkey(,C) "\xC7"
  101.  
  102. }
  103.  
  104. proc Sedit_ComposeUI {} {
  105.     global composedkey
  106.     if [Exwin_Toplevel .compose "Compose Key" Key] {
  107.     set f .compose
  108.     Widget_Message $f msg -aspect 1000 -text \
  109. "Compose Key Sequences
  110. Press the Compose key and the
  111. two-letter sequence on the left
  112. to get the special character
  113. in the right-hand column.
  114. You can define the Compose key
  115. in the Simple Edit dialog.
  116. The font used to display these
  117. characters is in the status line."
  118.     set t [Widget_Text $f 20 -width 20]
  119.     $t config -width 20
  120.     foreach family { courier lucidatypwriter lucida times palatino * } {
  121.         if {[catch {$t config -font -*-$family-medium-r-*-*-12-*-*-*-*-*-iso8859-1}] == 0} {
  122.         break
  123.         }
  124.     }
  125.     } else {
  126.     set t .compose.t
  127.     }
  128.     Exmh_Status [lindex [$t config -font] 4]
  129.     $t delete 1.0 end
  130.     foreach key [lsort [array names composedkey]] {
  131.     $t insert insert "  $key\t$composedkey($key)\n"
  132.     }
  133. }
  134.